package com.IntelligentCommunity.community.api.factory;

import com.IntelligentCommunity.common.core.domain.R;
import com.IntelligentCommunity.community.api.RemoteDoorService;
import com.IntelligentCommunity.community.domain.RealDoor;
import lombok.extern.log4j.Log4j2;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author：ZHP
 * @Package：com.IntelligentCommunity.community.api.factory
 * @Project：IntelligentCommunity
 * @name：RemoteDoorServiceFactory
 * @Date：2024/8/3 10:27
 * @Filename：RemoteDoorServiceFactory
 */
@Component
@Log4j2
public class RemoteDoorServiceFactory implements FallbackFactory<RemoteDoorService> {
    @Override
    public RemoteDoorService create(Throwable cause) {
        return new RemoteDoorService() {

            @Override
            public R add(RealDoor door) {
                log.error("门禁添加远程调用失败", cause);
                return R.fail("门禁添加远程调用失败");
            }
        };
    }
}
